package com.twang.stock.controller.common;

import com.alibaba.fastjson.JSONObject;
import com.twang.stock.dto.BaseRequest;
import com.twang.stock.dto.MatchDetails;
import com.twang.stock.dto.MatchWanZhuBeiDTO;
import com.twang.stock.service.WanZhuBeiChiChangService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.servlet.ModelAndView;

import java.util.List;

@Controller
@RequestMapping(value = "/wzb")
@Slf4j
public class WanZhuBeiController {

    @Autowired
    private WanZhuBeiChiChangService wanZhuBeiChiChangService;

    @RequestMapping(value = "/千万组")
    public ModelAndView risk(BaseRequest request) throws Exception {
        ModelAndView modelAndView = new ModelAndView();
        List<MatchDetails> list= wanZhuBeiChiChangService.千万组("136");
        modelAndView.addObject("qianWanZhu", list);
        modelAndView.setViewName("wanzhubei/index");
        return modelAndView;
    }

    @RequestMapping(value = "/比赛列表")
    public ModelAndView 比赛列表(BaseRequest request) throws Exception {
        ModelAndView modelAndView = new ModelAndView();
        List<JSONObject> list= wanZhuBeiChiChangService.获取比赛列表();
        wanZhuBeiChiChangService.获取比赛列表Group(list.get(0).get("id").toString(),list.get(0).get("end_time").toString()) ;
        modelAndView.addObject("qianWanZhu", list);
        modelAndView.setViewName("wanzhubei/index");
        return modelAndView;
    }
}
